/*-------------------------------------------------------------------------
 - Copyright (c) 2024-2025 [XD-AMCC TEAM]
 - [XD-AMCC] is licensed under Mulan PSL v2.
 - You can use this software according to the terms and conditions of the Mulan PSL v2.
 - You may obtain a copy of Mulan PSL v2 at:
 -          http://license.coscl.org.cn/MulanPSL2
 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES
 - OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
 - TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 - See the Mulan PSL v2 for more details.
 ------------------------------------------------------------------------*/

/**
 * @brief  Header of main module of AMCC.
 *
 * @author  WXQ#XDU
 * @date    2024.12
 */

#pragma once

#ifndef AMCC_MAIN_H
#define AMCC_MAIN_H

#include "amcc_log.h"
#include "amcc_error.h"
#include "parser.h"
#include "symtable.h"
#include "ircode.h"

AMCC_DECL_BEGIN

// Working data set of AMCC driver
typedef struct  main_work_data {
    int   targetPhase;  // perform to this phase, including previous phases
    t_tokenstream_ptr   pTokenStream;   // product of Lexer
    t_tree_ptr          pParseTreeRoot; // product of Parser
    t_symtable_ptr      pSymTableRoot;  // product of Symbol-Table-Builder
    t_program_codes     programCodes;   // product of IR-code emitter
} t_workdata, * t_workdata_ptr;

extern void  print_usage (const char* argv0);
extern int   parse_command_line (t_workdata_ptr pWorkdata,
                                 int argc, char *argv[]);


AMCC_DECL_END

#endif
